package com.artPreter.mapper;


import com.artPreter.pojo.Region;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 区域表 Mapper 接口
 * </p>
 *
 * @author jarvis
 * @since 2024-12-05
 */
@Mapper
public interface RegionMapper extends BaseMapper<Region> {

    @Select(" SELECT a.region as id,(select b.type FROM jv_region b  WHERE b.id = a.region ) as type,(select b.pid FROM jv_region b  WHERE b.id = a.region ) as pid,(select b.cityname FROM jv_region b  WHERE b.id = a.region ) as cityname  , COUNT(*) AS count FROM jv_depart a WHERE a.region is not null GROUP BY a.region ORDER BY count DESC ; ")
    List<Region> getDepartRegionList();
}
